var isValid = function(s) {
    let length = s.length
    if(length % 2 === 1) return false
    let brakArr = []
    for(let i = 0;i < length ;i++){
       if(s[i] === '{' || s[i]==='[' || s[i] === '('){
           brakArr.push(s[i])
       }else{
           if(!brakArr.length) return false
           let brak = brakArr[brakArr.length - 1] + s[i]
           console.log(brakArr);
           if(brak === '{}' || brak === '[]' || brak === '()'){
               brakArr.pop()
           } else {
               return false
           }
       }
    }
    return !brakArr.length
};
console.log(isValid('([}}])'))